﻿using System.Windows;
using System.Windows.Controls;
using Garfield.Controls;
using Garfield.Core;
using Garfield.Core.Runtime;
using Garfield.Presentation;
using Garfield.Presentation.Controls;
using Garfield.Presentation.View;

namespace ViewSites
{
    class ViewSitePlugin : Plugin
    {
        protected override void Initialize()
        {            
            Register(PresentationPlugin.ViewParts, "Main", Implementation<LaunchBar>());
            Register(PresentationPlugin.ViewParts, "HelloWorld", Implementation<TextBlock>(), textBlock => textBlock.Text = "Hello World");
            Register(PresentationPlugin.WindowChromes, "Default", Implementation<CustomWindow>(), window => window.Title = "Haha");

            Register(Platform.Services, Api<INavigator>(), Implementation<WindowNavigator>(), navigator => navigator.DefaultChrome = "Default");
        }

        public override void Start(IServiceLocator serviceLocator)
        {
            serviceLocator.GetService<INavigator>().NavigateToView("Main", new object[0]);
        }
    }
}
